package com.cartgo.manager
{
	import com.cartgo.vo.errors.VOSqlError;
	import com.cartgo.vo.errors.VOServiceError;
	
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	import mx.controls.Alert;
	import mx.rpc.events.FaultEvent;
	
	public class ErrorManager extends EventDispatcher
	{
		public function ErrorManager(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		public static function showRemoteObjectError(evt:FaultEvent):void {
			Alert.show(evt.fault.faultDetail + "\n\n" + evt.fault.faultString, "Remote Object Error!");
		}
		
		public static function showSqlError(error:VOSqlError):void
		{
			Alert.show("SQL Query:\n" + error.sql + "\n\n" + "Error Description: \n" + error.errorDesc, "SQL Error!");
		}
		
		public static function showServiceError(error:VOServiceError):void
		{
			Alert.show("Error:\n" +error.errorString + "\n\n" + "Error Description: \n" + error.errorDesc, "Service Error #" + error.errorCode);
		}
	}
}